
package com.yunfei.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfiguration {

    @Bean(value = "defaultApi")
    public Docket defaultApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(groupApiV2Info())
                .groupName("1.App端实名认证接口文档")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yunfei.api.smrz"))
                .paths(PathSelectors.any())
                .build();
    }


    private ApiInfo groupApiV2Info(){
        return new ApiInfoBuilder()
                .title("财富管理平台App端实名认证接口文档")
                .description("财富管理平台App端实名认证接口文档")
                .termsOfServiceUrl("http://ai.ylcaifu.com")
                .contact("zhengyunfei@ylcaifu.com")
                .version("2.0")
                .build();
    }
//文件上传

    @Bean(value = "uploadApi")
    public Docket uploadApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(uploadApiV2Info())
                .groupName("2.App端实名认证附件接口文档")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yunfei.api.upload"))
                .paths(PathSelectors.any())
                .build();
    }


    private ApiInfo uploadApiV2Info(){
        return new ApiInfoBuilder()
                .title("财富管理平台App端实名认证文件中心接口文档")
                .description("财富管理平台App端实名认证文件中心接口文档")
                .termsOfServiceUrl("http://ai.ylcaifu.com")
                .contact("zhengyunfei@ylcaifu.com")
                .version("2.0")
                .build();
    }

}
